package com.example.hospital.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hospital.mapper.PatientMapper;
import com.example.hospital.pojo.Patient;
import com.example.hospital.pojo.ResPageBean;
import com.example.hospital.service.IPatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IPatientServiceImpl extends ServiceImpl<PatientMapper, Patient> implements IPatientService {
    @Autowired
    private PatientMapper patientMapper;
    @Override
    public ResPageBean getPatientByPage(Integer currentPage, Integer size,String keyword) {
        Page<Patient> page = new Page<>(currentPage,size);
        IPage<Patient> patientByPage = patientMapper.getPatientByPage(page,keyword);
        ResPageBean resPageBean = new ResPageBean(patientByPage.getTotal(),patientByPage.getRecords());
        return resPageBean;
    }

    @Override
    public List<Patient> getSymptom(Integer id) {

        return patientMapper.getSymptom(id);
    }

    @Override
    public List<Patient> getOperation(Integer id) {
        return patientMapper.getOperation(id);
    }

    @Override
    public List<Patient> getBasic(Integer id) {
        return patientMapper.getBasic(id);
    }
}
